home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-09-17 | 11.2 KB | 342 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWProxy.h
- // Release Version: $ ODF 2 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPROXY_H
- #define FWPROXY_H
-
- // ----- ODF OS Includes -----
-
- #ifndef FWFXMATH_H
- #include "FWFxMath.h"
- #endif
-
- // ----- ODF Foundation Includes -----
-
- #ifndef FWSTDEF_H
- #include "FWStdDef.h"
- #endif
-
- #ifndef FWCLAINF_H
- #include "FWClaInf.h"
- #endif
-
- #ifndef FWPRIDEB_H
- #include "FWPriDeb.h"
- #endif
-
- #ifndef FWTCOLL_H
- #include "FWTColl.h"
- #endif
-
- //========================================================================================
- // Forward Declarations
- //========================================================================================
-
- class ODFrame;
- class ODShape;
- class ODFacet;
- class ODStorageUnitView;
- class ODTransform;
- class ODCanvas;
-
- class FW_CCloneInfo;
- class FW_CFrame;
- class FW_CEmbeddingFrame;
- class FW_CPresentation;
- class FW_CEmbeddingPart;
- class FW_CProxyFrame;
- class FW_CPoint;
- class FW_CString;
-
- //========================================================================================
- // class FW_MProxy
- //========================================================================================
-
- class FW_MProxy
- {
- public:
- friend class FW_CProxyProxyFrameIterator;
-
- //----------------------------------------------------------------------------------------
- // Initialization/Destruction
- //
- public:
- FW_MProxy(Environment* ev,
- FW_CEmbeddingPart* embeddingPart,
- FW_Boolean shown = TRUE);
- virtual ~FW_MProxy();
-
- //----------------------------------------------------------------------------------------
- // New API
- //
- public:
- // ----- Embedded frames manipulation -----
- void DetachEmbeddedFrames(Environment *ev);
- void AttachEmbeddedFrames(Environment *ev);
- FW_Boolean IsDetached(Environment *ev) const;
-
- void RemoveEmbeddedFrames(Environment *ev);
-
- // ----- Embedding -----
- void Embed(Environment *ev,
- FW_CPresentation* embeddingPresentation,
- ODPart *embeddedPart,
- ODFrame* odEmbeddedFrame, // Might be null
- ODType suggestedFrameType, // preferred frame type
- ODShape* frameShape,
- ODTypeToken viewType,
- ODTypeToken presentationType,
- ODID frameGroupID,
- FW_Boolean isOverlaid,
- FW_Boolean subFrame);
-
- virtual short CreateFacets(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFacet* embeddingFacet,
- ODFrame* embeddedFrame,
- ODShape* proposedClipShape) = 0;
-
-
- ODFacet* CreateFacet(Environment* ev,
- ODFacet* containingFacet,
- ODFrame* embeddedFrame,
- ODShape* clipShape,
- ODTransform* externalTransform,
- ODCanvas* canvas,
- ODCanvas* biasCanvas,
- ODFacet* siblingFacet,
- ODFramePosition position); // Must be used instead of ODFacet::CreateEmbeddedFacet
-
- virtual FW_Boolean NeedFacets(Environment *ev, FW_CEmbeddingFrame* embeddingFrame) const;
-
- // ----- Notification -----
- virtual void UsedShapeChanged(Environment *ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFrame* odEmbeddedFrame);
-
- virtual ODShape* FrameShapeRequested(Environment* ev,
- FW_CEmbeddingFrame* frame,
- ODFrame* odEmbeddedFrame,
- ODShape* requestedFrameShape);
-
- // ----- Query -----
- ODFacet* GetEmbeddedFacetUnderMouse(Environment* ev,
- ODFacet* embeddingFacet,
- const FW_CPoint& mouse) const;
-
- ODFrame* AcquireEmbeddedFrame(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- FW_Boolean instantiate = TRUE) const;
-
- FW_CProxyFrame* GetProxyFrame(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame) const;
- FW_CProxyFrame* GetProxyFrame(Environment* ev,
- ODID embeddedFrameID) const;
-
- FW_Boolean IsEmbeddedFrame(Environment* ev,
- ODFrame* odEmbeddedFrame) const;
-
- // ----- Active border -----
- virtual void AdjustBorderShape(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFacet* embeddedFacet,
- ODShape *shape);
-
- // ----- Persistence -----
- virtual void Externalize(Environment* ev,
- ODStorageUnitView* destinationSUView,
- FW_CCloneInfo *cloneInfo);
- virtual void Internalize(Environment* ev,
- ODStorageUnitView* sourceSUView,
- FW_CCloneInfo *cloneInfo);
-
- // ----- Selection state -----
- virtual void SetSelectState(Environment* ev,
- FW_Boolean state);
- FW_Boolean GetSelectState(Environment* ev) const;
-
- // ----- Reveal -----
- virtual FW_Boolean Reveal(Environment *ev,
- FW_CEmbeddingFrame* embeddingFrame,
- ODFrame* embeddedFrame,
- ODShape* revealShape);
-
- // ----- Notification -----
- virtual void ProxyFrameAdded(Environment* ev, FW_CProxyFrame* proxyFrame);
- virtual void ProxyFrameRemoved(Environment* ev, FW_CProxyFrame* proxyFrame);
-
- // ----- Highlight state -----
- void ChangeHighlight(Environment* ev,
- ODHighlight highlight,
- FW_CEmbeddingFrame* embeddingFrame = NULL);
-
- // ----- Hide/Show Proxy -----
- void HideShow(Environment* ev, FW_Boolean shown);
- FW_Boolean IsShown(Environment* ev) const;
-
- // ----- Open In Window (From OpenSelection Command) -----
- virtual void OpenInWindow(Environment* ev, FW_CProxyFrame* proxyFrame);
-
- // ----- Position all embedded frames of this proxy -----
- void ChangeExternalTransforms(Environment* ev,
- ODTransform* transform);
- void ChangeExternalTransforms(Environment* ev,
- FW_Fixed x,
- FW_Fixed y);
-
- // ----- Change the frame shape of all embedded frames of this proxy -----
- void ChangeFrameShapes(Environment* ev,
- ODShape* newShape);
- void ChangeFrameShapes(Environment* ev,
- FW_Fixed width,
- FW_Fixed height);
-
- // ----- Set the View Type of this proxy frames -----
- void ChangeEmbeddedFramesViewType(Environment *ev,
- ODTypeToken viewType);
-
- // ----- Frame Group/Sequence Number -----
- ODID GetFrameGroup(Environment *ev) const;
- ODID GetSequenceNumber(Environment *ev) const;
- void ChangeSequenceNumber(Environment *ev, ODID sequenceNumber);
-
- // ----- Getters/Setters -----
- ODPart* AcquireEmbeddedPart(Environment* ev, FW_Boolean instantiate = TRUE) const;
- void GetEmbeddedPartName(Environment* ev, FW_CString& string) const;
-
- FW_CEmbeddingPart* GetPart(Environment* ev) const;
-
- // ----- Change the link status of all embedded frames of this proxy -----
- void ChangeLinkStatus(Environment* ev, ODLinkStatus linkStatus);
-
- // ----- ReleaseAll -----
- virtual void ReleaseAll(Environment *ev);
-
- // ----- Purge -----
- virtual ODSize Purge(Environment* ev);
- void SetPurgeable(Environment* ev,
- FW_CEmbeddingFrame* embeddingFrame,
- FW_Boolean purgeable);
-
- //----------------------------------------------------------------------------------------
- // Implementation API
- //
- public:
- // ----- ProxyFrame Factories -----
- FW_CProxyFrame* PrivNewProxyFrame(Environment* ev,
- FW_CEmbeddingPart* part,
- ODStorageUnitView* suView);
- FW_CProxyFrame* PrivNewProxyFrame(Environment* ev,
- FW_CEmbeddingPart* part,
- FW_CEmbeddingFrame* containingFrame,
- ODFrame* embeddedFrame,
- FW_Boolean saveLimboState);
-
- void PrivAddProxyFrame(Environment* ev, FW_CProxyFrame* proxyFrame);
- void PrivDeleteProxyFrame(Environment* ev, FW_CProxyFrame* proxyFrame);
-
- FW_CProxyFrame* PrivContainerIDToProxyFrame(Environment* ev, ODStorageUnitID containerID) const;
-
- void PrivPostClone(Environment* ev,
- FW_CCloneInfo* cloneInfo);
-
- void PrivEmbeddedFacetRemoved(Environment* ev);
- unsigned short PrivGetEmbeddedFacetCount(Environment* ev) const;
-
- void PrivSetFrameGroup(Environment *ev, ODID frameGroup);
-
- //----------------------------------------------------------------------------------------
- // Data Members
- //----------------------------------------------------------------------------------------
-
- private:
- FW_Boolean fDetached;
- FW_TOrderedCollection<FW_CProxyFrame>* fProxyFrames;
- FW_CEmbeddingPart* fPart;
- FW_Boolean fSelected;
- ODStorageUnitID fClonedFrameID; // Used during cloning
- unsigned short fEmbeddedFacetCount;
- FW_Boolean fShown;
- ODID fFrameGroup;
- ODID fSequenceNumber;
- };
-
-
- //========================================================================================
- // FW_MProxy Inlines
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_MProxy::GetPart
- //----------------------------------------------------------------------------------------
- inline FW_CEmbeddingPart* FW_MProxy::GetPart(Environment*) const
- {
- return fPart;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MProxy::GetSelectState
- //----------------------------------------------------------------------------------------
- inline FW_Boolean FW_MProxy::GetSelectState(Environment*) const
- {
- return fSelected;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MProxy::PrivGetEmbeddedFacetCount
- //----------------------------------------------------------------------------------------
- inline unsigned short FW_MProxy::PrivGetEmbeddedFacetCount(Environment*) const
- {
- return fEmbeddedFacetCount;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MProxy::PrivEmbeddedFacetRemoved
- //----------------------------------------------------------------------------------------
- inline void FW_MProxy::PrivEmbeddedFacetRemoved(Environment*)
- {
- FW_ASSERT(fEmbeddedFacetCount != 0);
- fEmbeddedFacetCount--;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MProxy::GetFrameGroup
- //----------------------------------------------------------------------------------------
- inline ODID FW_MProxy::GetFrameGroup(Environment*) const
- {
- return fFrameGroup;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MProxy::GetSequenceNumber
- //----------------------------------------------------------------------------------------
- inline ODID FW_MProxy::GetSequenceNumber(Environment*) const
- {
- return fSequenceNumber;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MProxy::IsShown
- //----------------------------------------------------------------------------------------
- inline FW_Boolean FW_MProxy::IsShown(Environment*) const
- {
- return fShown;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MProxy::IsDetached
- //----------------------------------------------------------------------------------------
- inline FW_Boolean FW_MProxy::IsDetached(Environment*) const
- {
- return fDetached;
- }
-
- #endif
-
-